home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3363 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.9 KB  |  92 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: nntp.coast.net!torn!utnut!utgpu!normb
  3. From: normb@gpu.utcc.utoronto.ca (Norman Baccari)
  4. Subject: Re: Problems With LoadSeg()
  5. Message-ID: <DMIrD2.Lso@gpu.utcc.utoronto.ca>
  6. Organization: UTCC Public Access
  7. References: <DMF0vK.LI0@gpu.utcc.utoronto.ca> <4fd4kr$cu7@oak68.doc.ic.ac.uk>
  8. Distribution: Earth
  9. Date: Fri, 9 Feb 1996 17:31:50 GMT
  10.  
  11.  
  12. Youll have to excuse me as this is my first time working with
  13. resident struct & LoadSeg(), so this is looking
  14. a little hairy.
  15.  
  16. This section of code is from Ben Hutchings (thanks Ben)...
  17.  
  18. > if( libseg = LoadSeg(libname) ) /* use _full_ pathname */
  19. > {
  20. >    /* get pointer to embedded Resident structure */
  21. >    libres = (struct Resident *)((LONG *)BADDR(libseg)+2);
  22.      ^^^^^^
  23.      This allways seems to work.
  24. >
  25. >    /* check that it really is a library */
  26. >    if( ((ULONG *)libres)[-1] != 0x70ff4e75 ||
  27.                                   ^^^^^^^^^^
  28.      This doesnt Allways work. Some valid libraries have this value.
  29.      Any reason why I cant use the rt_Type Field and look for NT_LIBRARY??
  30.  
  31. >    libres->rt_MatchWord != RT_MATCHWORD ||
  32.                              ^^^^^^^^^^^^
  33.                       I guess you mean RTC_MATCHWORD
  34.  
  35. >    libres->rt_MatchPtr != (APTR)libres )
  36. >     /* rt_MatchPtr is wrong - I forget the real name */
  37.          I think this is rt_MatchTag and I've found that in most
  38.          cases, if these  pointers arent the same then I get bad data.
  39.  
  40. >         {
  41. >             /* copy fields */
  42. >         }
  43. >         else
  44. >             /* not a library */
  45. >         UnLoadSeg(libseg);
  46. >     }
  47.  
  48. This code says to me that if any of these fields != then I have
  49. a valid library?? Can this be right.If I loadseg() say amigaguide.library
  50. then I get...
  51.  
  52. libres[-1]   == 0x70ff4e75,
  53. rt_MatchWord == RT_MATCHWORD
  54. rt_MatchPtr  == (APTR)libres
  55.  
  56. So that doesnt work.
  57.  
  58.  
  59. I also received the follwing from Martin Frost (thanks Martin)...
  60.  
  61. > >      ResLib=(struct Resident *)((LONG *)BADDR(LibSeg)+2);
  62. >
  63. > Don't you actually need
  64. >
  65. > for(ResLib=(struct Resident *)BADDR(LibSeg);
  66.  
  67. Getting ResLib this way allways fails for me.
  68. Plus I Dont know why you have this in a for() loop.
  69.  
  70. >   ResLib->rt_MatchWord==0x4AFC && ResLib->rt_MatchPtr==ResLib;
  71.                                             ^^^^^^^^^^^
  72.                                             rt_MatchTag
  73. >   (UWORD *)ResLib++);
  74. >
  75.  
  76. In looking at the includes (exec/resident.h) the comment beside
  77. rt_MatchWord is /* word to match on (ILLEGAL) */ Does this mean
  78. its illegal to use this field??
  79.  
  80.  
  81. Thanks again for any and all help...
  82.  
  83. Still many questions...isnt ignorance wonderfull!
  84.  
  85.   Norm.
  86.  
  87.  ---------------------------------------------------------------------
  88.   Norman Baccari             | "OK team! You start coding.           
  89.   normb@gpu.utcc.utoronto.ca | I'll go see what the user specs are." 
  90.   Toronto,Ontario,Canada     |                                        
  91.  ---------------------------------------------------------------------
  92.